package com.example.userservice.client;

import java.util.concurrent.CompletableFuture;

public class DashScopeExample {

    public static void main(String[] args) throws InterruptedException {
        DashScopeClient client = new DashScopeClient();

//        //同步调用
//        String response1 = client.callSync("解释一下面向对象编程", "qwen-turbo");
//        System.out.println("同步响应: " + response1);

        //异步调用
        CompletableFuture<String> future = client.callAsync("用java实现冒泡排序", "qwen-turbo");
        future.thenAccept(response2 -> {
            System.out.println("异步响应: " + response2);
        });
//
//        //带参数调用
//        String response3 = client.callWithParam("用java写一个函数计算阶乘", "qwen-turbo", 0.7, 1000);
//        System.out.println("带参数响应: " + response3);
//
//        //等待异步调用完成
//        Thread.sleep(10000);
    }
}
